package com.yuda.campsite.mapper;

import com.yuda.campsite.domain.NewStudnet;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.*;

/**
 * @Author: xiaohudie
 * @Date: 2021/11/12 17:03
 * @Version: 1.8
 */
@Mapper
public interface NewStudnetMapper {
    @Select("SELECT\n" +
            "a.uuid,\n" +
            "\ta.nation,\n" +
            "\ta.gender,\n" +
            "\th.email,\n" +
            "\ta.start_school_date,\n" +
            "\ta.school_contacts,\n" +
            "\ta.school_phone,\n" +
            "\tf.NAME AS jiguan_province,\n" +
            "\te.NAME AS jiguan_city,\n" +
            "\tg.NAME AS school,\n" +
            "\ta.NAME,\n" +
            "\ta.phone,\n" +
            "\tb.examine_status,\n" +
            "\ta.id_card,\n" +
            "\tb.invitation_code,\n" +
            "\tb.pay_way,\n" +
            "\tb.pay_time,\n" +
            "\tb.STATUS,\n" +
            "\tb.pay_amount,\n" +
            "\ti.NAME AS yingdi_name,\n" +
            "\tj.NAME AS jinxiao_name,\n" +
            "\tl.`name` AS code_name ,\n" +
            "\tg.city_name as school_city,\n" +
            "\t g.province_name as school_province\n" +
            "FROM\n" +
            "\tstudent_info a\n" +
            "\tLEFT JOIN campsite_order b ON a.uuid = b.student_id\n" +
            "\tLEFT JOIN campsite_city e ON a.jiguan_city = e.id \n" +
            "\tLEFT JOIN campsite_province f ON a.jiguan_province = f.id \n" +
            "\tLEFT JOIN campsite_school g ON a.school = g.id\n" +
            "\tLEFT JOIN student_account h ON h.uuid = a.uuid\n" +
            "\tLEFT JOIN campsite_conf i ON b.campsite_id = i.id\n" +
            "\tLEFT JOIN campsite_distribution j ON b.`code` = j.uuid\n" +
            "\tLEFT JOIN invitation_code k ON b.invitation_code = k.\n" +
            "\tCODE LEFT JOIN invitation_code_classification l ON k.classifiction_id = l.id \n" +
            "WHERE\n" +
            "\tb.campsite_id = #{campsiteId} \n" +
            "GROUP BY\n" +
            "\ta.uuid \n" +
            "ORDER BY\n" +
            "\tb.add_time DESC")

   public  List<NewStudnet> newStudent(@Param("campsiteId") String campsiteId);
}
